var Row = function()
{
	this.template = null;
	var textNode = null;

	// taking template as argument
	if (arguments.length > 0)
	{
		this.template = arguments[0];
	}

	this.Id('row' + Math.random());

	this.Create = function()
	{
		if (this.template != null)
		{
			var el = $(this.template).clone(true);
			this.VisualNode(el.get(0));

		}
		else
		{
			var el = document.createElement('DIV');
			el.setAttribute('id', 'Row_' + this.Id())
			this.VisualNode(el);
			textNode = document.createTextNode('');
			el.appendChild(textNode);
		}

	}

	this.Template = function()
	{
		if (arguments.length == 0)
			return this.template;
		this.template = arguments[0];
		return this.template;
	}

	this.valueChanged = function()
	{
		//alert(this.Value().constructor==Object)

		if (this.template != null)
		{
			if (this.Value().constructor == Object)
			{
				for (key in this.Value())
				{
					$(this.VisualNode()).find(
							'[id$=TemplateRowValue' + key + ']').text(
							this.Value()[key]);

				}

			}
			else
			{
				$(this.VisualNode()).find('[id$=TemplateRowValue]').text(
						this.Value());
			}

		}
		else
		{
			textNode.nodeValue = this.Value();
		}
	}

}

Row.inherits(Component);
